<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->id()->comment('文章管理表');
            $table->string('category_id')->index()->comment('分类id');
            $table->integer('admin_id')->index()->comment('管理员id');
            $table->integer('product_id')->index()->comment('商品关联id');
            $table->integer('mer_id')->index()->comment('商户id');
            $table->string('system_admin_id')->index()->comment('创建者id');
            $table->string('title')->comment('文章标题');
            $table->string('author')->comment('文章作者');
            $table->string('image_input')->comment('文章图片');
            $table->string('synopsis')->comment('文章简介');
            $table->string('share_title')->nullable()->comment('文章分享标题');
            $table->string('share_synopsis')->nullable()->comment('文章分享简介');
            $table->text('content')->comment('文章内容');
            $table->integer('visit')->comment('浏览次数');
            $table->integer('sort')->default(0)->comment('排序');
            $table->string('url')->nullable()->comment('原文链接');
            $table->tinyInteger('status')->comment('状态:0否 1是(默认)');
            $table->tinyInteger('is_hide')->comment('是否隐藏:0隐藏 1不隐藏(默认)');
            $table->tinyInteger('is_hot')->comment('是否热门(小程序):0不热门 1热门(默认)');
            $table->tinyInteger('is_banner')->comment('是否轮播图(小程序)：0不轮播 1轮播(默认)');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}
